package com.eorchis.module.trainingquestionnaire.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.module.trainingneeds.domain.QuestionBank;
import com.eorchis.module.user.domain.User;

/**
 * Title: UserAnswerLink<br>
 * Description: 用户答卷关联信息实体对象<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author Max
 * @createDate 2014-08-28
 * @version $Revision$
 */
@Entity
@Table(name = "QUESTIONNAIRE_USER_ANSWER")
public class UserAnswerLink implements IBaseEntity {
	private static final long serialVersionUID = 1L;

	private String userAnswerId;//主键
	//private String userid;//用户ID
	private User user;//用户
	//private String questionnaireId;//问卷ID
	private QuestionnaireEntity questionnaire;//问卷对象
	//private String questionId;//ID
	private QuestionBank question;
	private String questionAnswer;//主观题答案
	private String questionOption;//客观题答案
	
	/**
	 * 获取主键
	 */	
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name="USER_ANSWER_ID")
	public String getUserAnswerId() {
		return userAnswerId;
	}
	/**
	 * 设置主键
	 */		
	public void setUserAnswerId(String userAnswerId) {
		this.userAnswerId = userAnswerId;
	}
	/**
	 * 获取主观题答案
	 */	
	@Column(name="QUESTION_ANSWER")
	public String getQuestionAnswer() {
		return questionAnswer;
	}
	/**
	 * 设置主观题答案
	 */		
	public void setQuestionAnswer(String questionAnswer) {
		this.questionAnswer = questionAnswer;
	}
	/**
	 * 获取客观题答案
	 */	
	@Column(name="QUESTION_OPTION")
	public String getQuestionOption() {
		return questionOption;
	}
	/**
	 * 设置客观题答案
	 */		
	public void setQuestionOption(String questionOption) {
		this.questionOption = questionOption;
	}
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "USERID", referencedColumnName = "USERID")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "QUESTIONNAIRE_ID", referencedColumnName = "QUESTIONNAIRE_ID")
	public QuestionnaireEntity getQuestionnaire() {
		return questionnaire;
	}
	public void setQuestionnaire(QuestionnaireEntity questionnaire) {
		this.questionnaire = questionnaire;
	}
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "QUESTION_ID", referencedColumnName = "QUESTION_ID")
	public QuestionBank getQuestion() {
		return question;
	}
	public void setQuestion(QuestionBank question) {
		this.question = question;
	}
	
	/**
	 * 记录日志使用
	 */
	public String toString() {
		return "";
	}
	
}
